home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / fonts / ppfont10.zip / READ.ME < prev   
Text File  |  1994-07-13  |  8KB  |  182 lines

  1. PPFONT.DLL copyright 1994 Paul F. Poellinger - Silent O Software
  2. -------------------------------------------------------------------
  3. v1.1 - 10/17/93 -- Added some needed garbage collection
  4. -------------------------------------------------------------------
  5.  
  6. Included:
  7.  
  8. PPFONT   DLL                 The real deal
  9. READ     ME                  self-reference (this)
  10. PPGLOBAL TXT                 VB constants
  11. PPFONT   TXT                 C header file extract
  12. PPFONT   LIB                 Import library for C
  13.  
  14. PPFONT   FRM                 .. \    Visual Basic
  15. PPFONT   MAK                   ..>   (version 2.0)
  16. PPFONT   BAS                 .. /    Example of PPFont function use
  17.  
  18. PPFONTNM FRM                 .. \    Visual Basic
  19. PPFONTNM MAK                   ..>   (version 2.0)
  20. PPFONTNM BAS                 .. /    Example of PPFont function use
  21.  
  22. ------------------------------ functions ------------------------------
  23.  
  24. PPFontFamNum  -- returns number of available font families
  25. PPFontFam     -- retrieves arrays of info about available font families
  26.  
  27. PPFontNum     -- returns number of available fonts in a family
  28. PPFont        -- retrieves arrays of info about fonts in a family
  29.  
  30. --------------------- C declarations ---------------------------------
  31.  
  32. int FAR PASCAL PPFontFamNum(HWND hwnd)
  33.           -- returns number of available font families
  34. int FAR PASCAL PPFontFam(HWND hwnd ,LPENUMLOGFONT lfstruct, LPNEWTEXTMETRIC tmstruct, LPINT ftype)
  35.           -- retrieves arrays of info about available font families
  36.  
  37. int FAR PASCAL PPFontNum(HWND hwnd, LPSTR lpszFamily)
  38.           -- returns number of available fonts in a family
  39. int FAR PASCAL PPFont(HWND hwnd ,LPENUMLOGFONT lfstruct, LPNEWTEXTMETRIC tmstruct, LPINT ftype, LPSTR lpszFamily)
  40.           -- retrieves arrays of info about fonts in a family
  41.  
  42. ------------ Visual Basic declarations ----------------------------
  43. Declare Function PPFontFam Lib "PPFONT.DLL" (ByVal hwnd As Integer, alf As NEWLOGFONT, atm As NEWTEXTMETRIC, aft As Integer) As Integer
  44. Declare Function PPFontFamNum Lib "PPFONT.DLL" (ByVal hwnd As Integer) As Integer
  45.  
  46. Declare Function PPFont Lib "PPFONT.DLL" (ByVal hwnd As Integer, alf As NEWLOGFONT, atm As NEWTEXTMETRIC, aft As Integer, ByVal afamily As String) As Integer
  47. Declare Function PPFontNum Lib "PPFONT.DLL" (ByVal hwnd As Integer, ByVal afamily As String) As Integer
  48.  
  49.           where:    hWnd ................ is a window handle
  50.                     alf  ................ is an array of logical font
  51.                                            structure as defined in
  52.                                            PPGLOBAL.TXT
  53.                     atm  ................ is an array of text metric
  54.                                            (physical font) structures
  55.                                            as defined in PPGLOBAL.TXT
  56.                     aft  ................ is an array of integers which
  57.                                           will receive the font type
  58.                                           (truetype, vector, raster, device)
  59.                     afamily ............. is a string variable which
  60.                                           contains the font family name
  61.                                           for which font info is desired
  62.  
  63.     NOTE: the NEWTEXTMETRIC and NEWLOGFONT structures are detailed
  64.           in the windows SDK.  Look there for a explanation of the
  65.           fields in them.  The layouts are included here in PPGLOBAL.TXT
  66.           and PPFONT.TXT, as are relevant variable declarations.
  67.  
  68. ======================== Visual Basic Example Usage ===================
  69. --------------------------------- font family info --------------------
  70.     Static lf() As NEWLOGFONT
  71.     Static tm() As NEWTEXTMETRIC
  72.     Static ftype() As Integer
  73.  
  74.     n = PPFontFamNum(hwnd)                       ' get number of families
  75.  
  76.     ReDim lf(n), tm(n), ftype(n)
  77.  
  78.     i = PPFontFam(hwnd, lf(1), tm(1), ftype(1))    ' get families
  79.  
  80.     For j = 1 To i
  81.         ft$ = "Vector"
  82.         If ftype(j) And TRUETYPE_FONTTYPE Then
  83.            ft$ = "TrueType"
  84.         Else
  85.            If ftype(j) And RASTER_FONTTYPE Then
  86.               ft$ = "Raster"
  87.            End If
  88.         End If
  89.         ' - - - - - - - - - - - - - - - - - - - - - remove null fill from
  90.         font$ = lf(j).lfFacename                   'structure string
  91.         For k = 1 To LF_FACESIZE
  92.             If Asc(Mid$(font$, k, 1)) = 0 Then
  93.                Exit For
  94.             End If
  95.         Next
  96.         font$ = Mid$(font$, 1, k - 1)
  97.         ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  98.  
  99.         l = Len(ft$)
  100.  
  101.         list1.AddItem font$ + "   * " + ft$
  102.     Next
  103.     list1.ListIndex = 4
  104.     list1_click
  105. ----------------------------- font info for a family -----------------
  106.     Static lf() As NEWLOGFONT
  107.     Static tm() As NEWTEXTMETRIC
  108.     Static ftype() As Integer
  109.  
  110.     list2.Clear
  111.     list3.Clear
  112.  
  113.     selfont$ = list1.List(list1.ListIndex)
  114.     n = InStr(selfont$, "*")
  115.     selfont$ = Trim(Mid$(selfont$, 1, n - 4))
  116.  
  117.     n = PPFontNum(hwnd, selfont$)         ' get number of fonts in family
  118.  
  119.     ReDim lf(n), tm(n), ftype(n)
  120.  
  121.     i = PPFont(hwnd, lf(1), tm(1), ftype(1), selfont$)    ' get fonts
  122.  
  123.     For j = 1 To i
  124.         list2.AddItem lf(j).lfFullname
  125.         list3.AddItem lf(j).lfStyle
  126.     Next
  127. ----------------------------- family/font name retrieval --------------
  128. *** the following is how I had to define the name strings to get
  129. *** VB to accept the font/family names on return
  130.  
  131. Type lfFaceName
  132.      FaceName As String * LF_FACESIZE                   ' 32
  133. End Type
  134. Type lfFullName
  135.      FullName As String * LF_FULLFACESIZE               ' 64
  136. end type
  137.  
  138.  
  139. Declare Function PPFontFamNames Lib "PPFONT.DLL" (ByVal hwnd As Integer, afn As lfFaceName, aft As Integer) As Integer
  140. Declare Function PPFontNames Lib "PPFONT.DLL" (ByVal hwnd As Integer, afn As lfFullName, aft As Integer, ByVal afamily As String) As Integer
  141.  
  142.     i = PPFontNames(hwnd, lf(1), ftype(1), selfont$)
  143.  
  144.     i = PPFontFamNames(hwnd, lf(1), ftype(1))
  145. ====================================================================
  146. Hope these are helpful.  There are others (see WINP15, ORIENT.ZIP,
  147. PPRTR4.ZIP, WINPTR.ZIP ... Compuserve MSBASIC, WINSHARE fora).
  148.  
  149. A tip of the pelican's beak to OsoSoft George Campbell who suggested the
  150. original idea for this DLL.  It has been extensively tested by me and
  151. George, but YMMV.
  152.  
  153. You are free to try this DLL for 30 days.
  154.  
  155. If you decide to use it thereafter, you are obligated to send $10 to
  156.                      PAUL POELLINGER
  157.                      2019 Round Lake Drive
  158.                      Houston, TX  77077
  159.  
  160. If you live in Texas, it'll cost you $10.83...sales tax :-(
  161.  
  162. OR...you can GO SWREG on compuserve...I charge $12 that way cause
  163. Compuserve takes 15%.
  164.  
  165. After doing so, you are free to use it in your applications, and
  166. to distribute it with such applications, as long as you do not
  167. charge separately for the DLL or publish its calling conventions.
  168.  
  169. You are free to pass this package on to others or upload it to
  170. bulletin boards provided that 1) you do not charge for it above
  171. the cost of distribution, and 2) all parts of the package are
  172. included (see "included" at the top).
  173.  
  174. Thank you for supporting shareware.
  175. -------------------------------------------------------------------
  176. Let me know if you have any trouble or suggestions.
  177.  
  178.       Paul Poellinger
  179.       Compuserve 70732,3576
  180.                                       7-12-94
  181.